package com.eliaukjq.xunlianying;

import java.awt.*;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2024/7/11 - 19:38
 */
public class Car {
    // 成员变量
    private String color; // 非静态成员变量
    private static int numberOfCars; // 静态成员变量

    public Car(String color) {
        this.color = color;
        numberOfCars++;
    }

    public Car() {
        this.color = String.valueOf(Color.red);
    }

    public static void displayNumberOfCars() {
        System.out.println(new Car().color);
        System.out.println("Number of cars: " + numberOfCars);
    }

    public static void main(String[] args) {
        displayNumberOfCars();
    }
}